/**
 * Historico de alteração
 *
 * Data         Autor   Descrição
 * 24/10/2010   Jerry   Criação do cabeçalho.
 *
 */

package Instrumentos;

import java.awt.*;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.dial.*;
import org.jfree.data.general.DefaultValueDataset;
import org.jfree.ui.GradientPaintTransformType;
import org.jfree.ui.StandardGradientPaintTransformer;

public class InstrumentoPressao extends JFrame implements ChangeListener
{
	

		DefaultValueDataset dataset1;

		public void stateChanged(ChangeEvent changeevent) {}

        public void setValor(double valor) {
             this.dataset1.setValue(valor);
        }

		public InstrumentoPressao(String title)
		{
			super(title);
			dataset1 = new DefaultValueDataset(10D);
			DialPlot dialplot = new DialPlot();
			dialplot.setView(0.0D, 0.0D, 1.0D, 1.0D);
			dialplot.setDataset(0, dataset1);
		    StandardDialFrame standarddialframe = new StandardDialFrame();
			standarddialframe.setBackgroundPaint(Color.lightGray);
			standarddialframe.setForegroundPaint(Color.darkGray);
			dialplot.setDialFrame(standarddialframe);
			GradientPaint gradientpaint = new GradientPaint(new Point(), new Color(255, 255, 255), new Point(), new Color(170, 170, 220));
			DialBackground dialbackground = new DialBackground(gradientpaint);
			dialbackground.setGradientPaintTransformer(new StandardGradientPaintTransformer(GradientPaintTransformType.VERTICAL));
			dialplot.setBackground(dialbackground);
			StandardDialScale standarddialscale = new StandardDialScale(0D, 100D, -120D, -300D, 10D, 4);
			standarddialscale.setTickRadius(0.88D);
			standarddialscale.setTickLabelOffset(0.14999999999999999D);
			standarddialscale.setTickLabelFont(new Font("Dialog", 0, 14));
			dialplot.addScale(0, standarddialscale);
			org.jfree.chart.plot.dial.DialPointer.Pointer pointer = new org.jfree.chart.plot.dial.DialPointer.Pointer(0);
            pointer.setRadius(0.68);
			dialplot.addPointer(pointer);
			DialCap dialcap = new DialCap();
			dialcap.setRadius(0.10000000000000001D);
			dialplot.setCap(dialcap);
			JFreeChart jfreechart = new JFreeChart(dialplot);
			jfreechart.setTitle("Pressão - psi");
		    ChartPanel chartpanel = new ChartPanel(jfreechart);
			chartpanel.setPreferredSize(new Dimension(400, 400));
			add(chartpanel);
		}
}
